config:
  build_1:
    stage: build
    script: exit 0

  build_2:
    stage: build
    script: exit 0

  test:
    stage: test
    script: exit 0
    when: on_failure

  deploy:
    stage: deploy
    script: exit 0
    when: always
    needs: [build_1, test]

init:
  expect:
    pipeline: pending
    stages:
      build: pending
      test: created
      deploy: created
    jobs:
      build_1: pending
      build_2: pending
      test: created
      deploy: created

transitions:
  - event: success
    jobs: [build_1, build_2]
    expect:
      pipeline: running
      stages:
        build: success
        test: skipped
        deploy: pending
      jobs:
        build_1: success
        build_2: success
        test: skipped
        deploy: pending

  - event: success
    jobs: [deploy]
    expect:
      pipeline: success
      stages:
        build: success
        test: skipped
        deploy: success
      jobs:
        build_1: success
        build_2: success
        test: skipped
        deploy: success

# TODO: should we run deploy?
# Further discussions: https://gitlab.com/gitlab-org/gitlab/-/issues/213080
